Skip to content

Grunt jshint:plugins: Ignore node_modules and common paths for built files. - #13207

Closed
afercia wants to merge 1 commit into
WordPress:trunkfrom
afercia:try/jshint-plugins-exclusions
Closed

Grunt jshint:plugins: Ignore node_modules and common paths for built files.#13207
afercia wants to merge 1 commit into
WordPress:trunkfrom
afercia:try/jshint-plugins-exclusions

Conversation

@afercia

@afercia afercia commented Aug 20, 2026

Copy link
Copy Markdown
Member

Trac ticket: https://core.trac.wordpress.org/ticket/65923

Adds an ignore property to the Grunt jshint:plugins to exclude any directory where the name matches:

  • build
  • dist
  • gutenberg
  • node_modules
  • packages
  • test
  • vendor

Use of AI Tools

None


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

@github-actions

github-actions Bot commented Aug 20, 2026

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props afercia, westonruter.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions

Copy link
Copy Markdown

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

@westonruter westonruter left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment thread Gruntfile.js
ignore: [
'**/build/**',
'**/dist/**',
'**/gutenberg/**',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't this technically be redundant since the relevant files in Gutenberg would themselves be ignored by the other globs?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gutenberg contains folders that contain .js files that aren't caught by the other globs, for example:

  • storybook
  • tools

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One way to double check is: run this command with and without the Gutenberg glob:
grunt jshint:plugins 2>&1 | grep -E "(\/.*\.js)"

without the Gutenberg glob there are a few more Gutenberg directories being scanned.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the WordPress core Grunt configuration for the jshint:plugins target to avoid linting (and ideally avoid traversing) common dependency/build output directories inside wp-content/plugins.

Changes:

  • Adds an ignore list to the jshint:plugins file expansion configuration intended to skip common build/dependency directories.
  • Documents the rationale as a performance optimization during glob expansion.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread Gruntfile.js
Comment on lines +1072 to +1076
// Prevent traversal into these directories during glob expansion.
// This is much faster than using negation patterns alone.
ignore: [
'**/build/**',
'**/dist/**',

@afercia afercia Aug 26, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem to be true as the folders matching these globs are skipped.

Comment thread Gruntfile.js
Comment on lines +1075 to +1079
'**/build/**',
'**/dist/**',
'**/gutenberg/**',
'**/node_modules/**',
'**/packages/**',
@westonruter
westonruter self-requested a review August 26, 2026 16:34
@afercia
afercia force-pushed the try/jshint-plugins-exclusions branch from 0be7b31 to 95192e6 Compare August 26, 2026 20:55
pento pushed a commit that referenced this pull request Aug 27, 2026
…build output directories.

The Grunt task `jshint:plugins` is meant to allow plugin developers easier access to JSHint and support good coding standards. Plugin developers can run it to lint their plugin JavaScript files.

The script can't handle built files though and it hangs indefinitely when scanning large dependency directories like `node_modules` that many modern plugins use.

Adds an ignore list to the `jshint:plugins` file expansion configuration intended to skip common build/dependency directories.

Developed in #13207

Props afercia, westonruter.
Fixes #65923.


git-svn-id: https://develop.svn.wordpress.org/trunk@63364 602fd350-edb4-49c9-b593-d223f7449a82
@github-actions

Copy link
Copy Markdown

A commit was made that fixes the Trac ticket referenced in the description of this pull request.

SVN changeset: 63364
GitHub commit: de9fe67

This PR will be closed, but please confirm the accuracy of this and reopen if there is more work to be done.

@github-actions github-actions Bot closed this Aug 27, 2026
markjaquith pushed a commit to markjaquith/WordPress that referenced this pull request Aug 27, 2026
…build output directories.

The Grunt task `jshint:plugins` is meant to allow plugin developers easier access to JSHint and support good coding standards. Plugin developers can run it to lint their plugin JavaScript files.

The script can't handle built files though and it hangs indefinitely when scanning large dependency directories like `node_modules` that many modern plugins use.

Adds an ignore list to the `jshint:plugins` file expansion configuration intended to skip common build/dependency directories.

Developed in WordPress/wordpress-develop#13207

Props afercia, westonruter.
Fixes #65923.

Built from https://develop.svn.wordpress.org/trunk@63364


git-svn-id: http://core.svn.wordpress.org/trunk@62557 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants